﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DeveloperSite.Master" AutoEventWireup="true" 
    CodeBehind="Add_Report.aspx.cs" Inherits="UNDP_Projects.Project.Add_Report" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
            white-space: nowrap;
        }
        .rowstyle1
        {
            padding: .5em 0 .5em 1.5em;
        }
        .rowstyle2
        {
            padding: 0 0 .5em 1.5em;
            font-size:8pt;
        }
        .rowstyle3
        {
            padding: .5em 0 0 1.5em;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:EntityDataSource ID="ProjectDataSource" runat="server" 
        ConnectionString="name=UNDPEntities" DefaultContainerName="UNDPEntities" 
        EnableFlattening="False" EntitySetName="projects" 
        Select="it.[project_id], it.[project1]">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="ReportPeriodDataSource" runat="server" 
        ConnectionString="name=UNDPEntities" DefaultContainerName="UNDPEntities" 
        EnableFlattening="False" EntitySetName="report_period" 
        Select="it.[report_period_id], it.[report_period1]">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="YearDataSource" runat="server" 
        ConnectionString="name=UNDPEntities" DefaultContainerName="UNDPEntities" 
        EnableFlattening="False" EntitySetName="years" 
        Select="it.[year_id], it.[year1]">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="DonorDataSource" runat="server" 
        ConnectionString="name=UNDPEntities" DefaultContainerName="UNDPEntities" 
        EnableFlattening="False" EntitySetName="donors" Select="it.[donor1]">
    </asp:EntityDataSource>

    <div style="text-align:center">
    <div style="width:70%; margin-left: auto; margin-right: auto; text-align: left;">
    <div style="float:left;">
        <asp:Table ID="T1" runat="server" CssClass="style1">
            <asp:TableRow>
                <asp:TableCell>
                    <asp:Label ID="ProjectLabel" runat="server" Text="Project:"></asp:Label>
                </asp:TableCell>
                <asp:TableCell CssClass="rowstyle1">
                    <asp:DropDownList ID="ProjectList" runat="server" 
                        DataSourceID="ProjectDataSource" DataTextField="project1" 
                        DataValueField="project_id" Width="282px">
                    </asp:DropDownList>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow><asp:TableCell></asp:TableCell><asp:TableCell CssClass="rowstyle1"></asp:TableCell></asp:TableRow>
            <asp:TableRow>
                <asp:TableCell>
                    <asp:Label ID="DonorLabel" runat="server" Text="Donors:"></asp:Label>
                </asp:TableCell>
                <asp:TableCell CssClass="rowstyle3">
                    <asp:ListBox ID="DonorListBox" runat="server" Rows="6" Width="282px" 
                        SelectionMode="Multiple" DataSourceID="DonorDataSource" 
                        DataTextField="donor1" DataValueField="donor1"></asp:ListBox>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow>
                <asp:TableCell></asp:TableCell>
                <asp:TableCell CssClass="rowstyle2">
                    <asp:Label ID="L1" runat="server" ForeColor="#0055cc">
                        *Hold "ctrl" key down to select multiple donors.
                    </asp:Label>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow>
                <asp:TableCell></asp:TableCell>
                <asp:TableCell CssClass="rowstyle1">
                    <asp:RequiredFieldValidator ID="DonorValidator" runat="server" 
                        ErrorMessage="Please select your Donor(s)" 
                        ControlToValidate="DonorListBox" ForeColor="Red" 
                        SetFocusOnError="True"></asp:RequiredFieldValidator>
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </div>

    <div style="float:right;">
        <asp:Table ID="T2" runat="server" CssClass="style1">
            <asp:TableRow>
                <asp:TableCell>
                    <asp:Label ID="ReportPeriodLabel" runat="server" Text="Report period:"></asp:Label>
                </asp:TableCell>
                <asp:TableCell CssClass="rowstyle1">
                    <asp:DropDownList ID="ReportPeriodList" runat="server" 
                        DataSourceID="ReportPeriodDataSource" DataTextField="report_period1" 
                        DataValueField="report_period_id" Width="200px">
                    </asp:DropDownList>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow>
                <asp:TableCell>
                    <asp:Label ID="YearLabel" runat="server" Text="Year:"></asp:Label>
                </asp:TableCell>
                <asp:TableCell CssClass="rowstyle1">
                    <asp:DropDownList ID="YearList" runat="server" DataSourceID="YearDataSource" 
                        DataTextField="year1" DataValueField="year_id">
                    </asp:DropDownList>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow>
                <asp:TableCell>
                    <asp:Label ID="EditorLabel" runat="server" Text="Prepared by:"></asp:Label>
                </asp:TableCell>
                <asp:TableCell CssClass="rowstyle3">
                    <asp:TextBox ID="EditorTextBox" runat="server" TextMode="MultiLine" 
                        Height="70px" Width="200px" CssClass="MText"></asp:TextBox>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow>
                <asp:TableCell></asp:TableCell>
                <asp:TableCell CssClass="rowstyle2">
                    <asp:Label ID="L2" runat="server" ForeColor="#0055cc">
                        *Enter full names.
                    </asp:Label>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow>
                <asp:TableCell></asp:TableCell>
                <asp:TableCell CssClass="rowstyle1">
                    <asp:RequiredFieldValidator ID="EditorValidator" runat="server" 
                        ErrorMessage="What's your name?" ControlToValidate="EditorTextBox" 
                        ForeColor="Red" SetFocusOnError="True"></asp:RequiredFieldValidator>
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </div>
    <br />
    <div style="text-align:center; margin-top:200px;">
    <asp:Table ID="Table1" runat="server" CssClass="style1">
        <asp:TableRow>
            <asp:TableCell></asp:TableCell>
            <asp:TableCell CssClass="rowstyle1">
                <% if (User.IsInRole("Administrator") | User.IsInRole("Project"))
                   { %>
                <asp:Button ID="ReportButton" runat="server" Text="Create New Report" 
                    onclick="ReportButton_Click" />
                    <% }
                   else
                   { %>
                   <asp:Button ID="Button1" runat="server" Text="Create New Report" 
                    onclick="ReportButton_Click" Enabled="false" />
                    <% } %>
            </asp:TableCell>
        </asp:TableRow>
    </asp:Table></div>
    </div></div><br />
    <asp:Label ID="Error" runat="server" Text="" Visible="false"></asp:Label>

    <div style="text-align:center; padding-top:2em;">
        <asp:Image ID="Image1" runat="server" ImageUrl="~/Styles/Simages/picstrip.png" />
    </div>
</asp:Content>
